package com.github.ecbp.common.data.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.ecbp.common.api.CommonPage;
import com.github.ecbp.common.req.BaseIdListDTO;
import com.github.ecbp.common.resp.NameVo;

import java.io.Serializable;
import java.util.List;

public interface BaseService<T> extends IService<T> {

    /**
     * 分页查询
     *
     * @param entity
     * @return
     */
    IPage<T> page(T entity);

    <VO> IPage<VO> page(Object param, Class<VO> targetClass);

    List<T> getByIds(BaseIdListDTO param);

    List<NameVo> getIdAndNameByIds(BaseIdListDTO param);

    List<NameVo> listIdAndName();

    boolean saveBase(Object entity);

    boolean saveOrUpdateBase(Object param);

    boolean saveBatchBase(List<Object> param);

    boolean saveOrUpdateBatchBase(List<Object> param);

    boolean updateByIdBase(Object param);

    boolean updateBatchByIdBase(List<Object> param);

    boolean removeByIdBase(Serializable id);

    boolean removeBase(Wrapper<T> wrapper);
}

